package com.alex.dao;

import com.alex.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

//@Mapper
public interface UserMapper {

    int addUser(User user);

    int deleteUser(int Id);

    @Update("update user set name=#{name} where id=#{id}")
    int updateUser(User user);

    // 方法有多个参数时,必须加上参数注解(仅对基本数据类型,包装类型和String类型有效)
    @Update("update user set name=#{name},pwd=#{pwd} where id=#{id}")
    int updateUser1(@Param("id") int id, @Param("name") String username, @Param("pwd") String password);

    @Select("select * from user where id=#{id}")
    User getUser(int id);

    @Select("select * from user")
    List<User> getUserList();

    List<User> getUserListLimit(int limit);

    int addUserWithMap(Map<String, Object> map);

    int updateUserWithMap(Map<String, Object> map);

    List<User> getUserLike(String value);

    int addUsers(List<User> users);
}
